# 9/29/89 sad check for files in wrong project and files with wrong name
# 9/22/89 sad fix case of fewer files on disk than in project; put out both version numbers
# 8/4/89 sad more useful output, notice canceled checkout modifys
# 7/31/89 sad finished writing
#
# To Do:
# can’t handle file name with spaces
# settings of CaseSensitive and =~ can probably be used instead of RelString
# If MPW had > and < and for strings we wouldn’t need RelString and would be a lot faster.
#
Set Exit 0
Set CaseSensitive 0
Begin
# first get all the check-out directories
Set CheckOutDirs "`CheckOutDir -m -r; Set CheckOutDirStatus {Status}; Echo`"
Exit If {CheckOutDirStatus}
Loop
Break If "{CheckOutDirs}" !~ / *CheckOutDir +-project ∂'«0,1»([¬:]+∫)®1∂'«0,1» ∂'«0,1»([¬∫]*:)®2∂'«0,1» (≈)®3/
Set Project "{®1}"
Set CheckOutDir "{®2}"
Set CheckOutDirs "{®3}"
# now for each directory, get all modified files in the project
Set Info "`ProjectInfo -s -latest -project "{Project}"; Set ProjectInfoStatus {Status}`"
If {ProjectInfoStatus} ≠ 0
Echo "### {0} - ProjectInfo of “{Project}” failed."
Exit {ProjectInfoStatus}
End
For File in `Files -s "{CheckOutDir}"`
Loop
Set BreakOut 1
Break If "{Info}" !~ /[¬,]* ∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»(≈)®5/
Set BreakOut 0
Set ProjectFileName "{®1}"
Set ProjectVersNum "{®2}"
Set ProjectBranch "{®3}"
Set ProjectModFlag "{®4}"
Set ProjectVersInfo "{®2}{®3}{®4}"
Set ProjectNextInfo "{®5}"
Set DirFile "{CheckOutDir}{File}"
# If `RelString "{File}" "{ProjectFileName}"` == 0
If "{File}" == "{ProjectFileName}"
If `Exists "{DirFile}"`"" ≠ ""
Set FileInfo "`ProjectInfo "{DirFile}"`"
If "{FileInfo}" =~ /∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»( WARNING: this file has been renamed!)«0,1»≈Project: ([¬:]+∫)®5 Checked out: ≈/
Set FileFileName "{®1}"
Set FileVersNum "{®2}"
Set FileBranch "{®3}"
Set FileModFlag "{®4}"
Set VersInfo "({®2}{®3}{®4} vs {ProjectVersInfo})"
Set FileProject "{®5}"
# If `RelString "{FileProject}" "{Project}"` ≠ 0
If "{FileProject}" ≠ "{Project}"
Quote -n File "{DirFile}"
Echo " ### is in the wrong project (“{FileProject}” vs “{Project}”)"
# Else # if I use “Else If” here RelString is always run (i.e. “If expr1 … Else If expr2 … End” is strict w.r.t. expr2)
# If `RelString "{FileFileName}" "{ProjectFileName}"` ≠ 0
Else If "{FileFileName}" ≠ "{ProjectFileName}"
Quote -n File "{DirFile}"
Echo " ### has been renamed (from “{ProjectFileName}” to “{File}”)"
# End
Else If {FileVersNum} < {ProjectVersNum}
Quote -n CheckOut -project "{Project}" "{File}"
Echo -n " ### is old"
If "x{FileModFlag}" == "x*"
Echo -n " and modifyreadonly"
Else If "x{FileModFlag}" == "x+"
Echo -n " and no longer checked out modify"
End
Echo " {VersInfo}"
Else If {FileVersNum} > {ProjectVersNum}
Quote -n File "{DirFile}"
Echo " ### is too new {VersInfo}"
Else
If "x{FileModFlag}" == "x*"
Quote -n File "{DirFile}"
Echo " ### is modifyreadonly {VersInfo}"
Else If "x{ProjectModFlag}" == "x" && "x{FileModFlag}" == "x+"
Quote -n File "{DirFile}"
Echo " ### check out modify has been canceled {VersInfo}"
If "{FileInfo}" =~ /∂'«0,1»([¬,]+)®1,([0-9]+)®2([0-9.a-z]*)®3([+*]«0,1»)®4∂'«0,1»( WARNING: this file has been renamed!)«0,1»≈Project: ([¬:]+∫)®5 Checked out: ≈/
Set FileFileName "{®1}"
Set FileVersNum "{®2}"
Set FileBranch "{®3}"
Set FileModFlag "{®4}"
Set VersInfo "({®2}{®3}{®4} vs {ProjectVersInfo})"
Set FileProject "{®5}"
# If `RelString "{FileProject}" "{Project}"` ≠ 0
If "{FileProject}" ≠ "{Project}"
Quote -n File "{DirFile}"
Echo " ### is in the wrong project (“{FileProject}” vs “{Project}”)"
Else
Quote -n File "{DirFile}"
Echo " ### is no longer in the project “{Project}”"